<template>
  <div class="container">
    <div class="header">
      <span @click="goBack" class="back">
        <van-icon name="arrow-left" style="margin-bottom:2px" />返回
      </span>
      <div class="title">发票抬头</div>
      <div class="modify" @click="Modify">修改</div>
    </div>

    <div class="body" ref="container">
      <div class="name">合肥崇武商贸有限公司</div>

      <div class="item van-hairline--bottom van-hairline--top">
        <span>税号</span>
        <span>91340100322780708G</span>
      </div>
      <div class="item van-hairline--bottom">
        <span>单位地址</span>
        <span>合肥市庐阳区都汇华郡公馆19幢2004室</span>
      </div>
      <div class="item van-hairline--bottom">
        <span>联系电话</span>
        <span>15605607760</span>
      </div>
      <div class="item van-hairline--bottom">
        <span>开户银行</span>
        <span>中国建设银行合肥市城东支行</span>
      </div>
      <div class="item van-hairline--bottom">
        <span>银行账号</span>
        <span>34001448608053017076</span>
      </div>
    </div>
    <div class="copy" @click="copyData">复制</div>

  </div>
</template>

<script>
export default {
  data() {
    return {
      copyText:''
    };
  },
  created() {
    // this.$toast(this.$route.params.num);
  },
  methods: {
    goBack() {
      this.$router.back();
    },
    Modify() {
      this.$router.push({
        name:'addBuyer',
        params:{
          data:JSON.stringify(this.$refs.container.innerText)
        }
      });
    },
    copyData() {
      this.$copyText(this.$refs.container.innerText).then(()=>{
        this.$toast.success('复制成功');
      })
    },
  },
};
</script>

<style lang="less" scoped>
.container {
  background-color: #def3e2;
  height: 100vh;
}
.header {
  display: flex;
  height: 4rem;
  line-height: 4rem;
  background-color: #07c160;
  color: #fff;
  text-align: center;
  .title {
    flex: 8;
  }
  .modify {
    flex: 1.5;
  }

  .back{
    flex: 1.5;
  }
}

.body {
  width: 90vw;
  margin: auto;
  margin-top: 1rem;
  background-color: #fff;
  padding: 0 1rem;
  border-radius: 0.8rem 0.8rem 0 0;
  color: #999;
  box-shadow: 1px -3px 8px 2px rgba(0, 0, 0, 0.1);
  .name {
    height: 5rem;
    line-height: 5rem;
    text-align: center;
    color: #333;
  }
  .item {
    display: flex;
    justify-content: space-between;
    height: 4rem;
    line-height: 4rem;
    font-size: 14px;
  }
}

.copy {
  height: 5rem;
  line-height: 5rem;
  text-align: center;
  color: #07c160;
  background-color: #fff;
  width: 90vw;
  margin: auto;
  padding: 0 1rem;
  border-top: 2px solid #eee;
}
</style>